Skip to content

Conversation

philnik777
Copy link
Contributor

This also removes some tests which were redundant, wrong, or never run. Specifically,

  • libcxx/utilities/meta/stress_tests/* were never run and are of questionable usefulness
  • libcxx/utilities/template.bitset/includes.pass.cpp is completely redundant and partially incorrect

Also notably, libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
has been refactored to only test the standard mandate.

@philnik777 philnik777 requested a review from a team as a code owner August 11, 2025 09:29
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 11, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

This also removes some tests which were redundant, wrong, or never run. Specifically,

  • libcxx/utilities/meta/stress_tests/* were never run and are of questionable usefulness
  • libcxx/utilities/template.bitset/includes.pass.cpp is completely redundant and partially incorrect

Also notably, libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
has been refactored to only test the standard mandate.


Full diff: https://github.com/llvm/llvm-project/pull/152982.diff

14 Files Affected:

  • (removed) libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp (-39)
  • (removed) libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_is_same.sh.cpp (-55)
  • (removed) libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp (-65)
  • (removed) libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp (-119)
  • (removed) libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp (-33)
  • (added) libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp (+33)
  • (renamed) libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp ()
  • (renamed) libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp ()
  • (removed) libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp (-22)
  • (renamed) libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/visibility_inlines_hidden.cpp (-1)
  • (renamed) libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp ()
  • (renamed) libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp ()
  • (renamed) libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp ()
  • (renamed) libcxx/test/std/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp ()
diff --git a/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp b/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
deleted file mode 100644
index 1b84a9bfe47da..0000000000000
--- a/libcxx/test/libcxx/language.support/support.c.headers/support.c.headers.other/math.lerp.verify.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// When built with modules, this test gives diagnostics like
-//  declaration of 'lerp' must be imported from module 'std.compat.cmath'
-//  before it is required
-// therefore disable the test in this configuration.
-// UNSUPPORTED: clang-modules-build
-
-// <math.h>
-
-// [support.c.headers.other]/1
-//   ... except for the functions described in [sf.cmath], the
-//   std::lerp function overloads ([c.math.lerp]) ...
-
-#include <math.h>
-
-void f() {
-  {
-    float f;
-    ::lerp(f, f, f);    // expected-error {{no member named 'lerp' in the global namespace}}
-    std::lerp(f, f, f); // expected-error {{no member named 'lerp' in namespace 'std'}}
-  }
-  {
-    double d;
-    ::lerp(d, d, d);    // expected-error {{no member named 'lerp' in the global namespace}}
-    std::lerp(d, d, d); // expected-error {{no member named 'lerp' in namespace 'std'}}
-  }
-  {
-    long double l;
-    ::lerp(l, l, l);    // expected-error {{no member named 'lerp' in the global namespace}}
-    std::lerp(l, l, l); // expected-error {{no member named 'lerp' in namespace 'std'}}
-  }
-}
diff --git a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_is_same.sh.cpp b/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_is_same.sh.cpp
deleted file mode 100644
index cfd8adb52d854..0000000000000
--- a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_is_same.sh.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a dummy feature that prevents this test from running by default.
-// REQUIRES: template-cost-testing
-
-// The table below compares the compile time and object size for each of the
-// variants listed in the RUN script.
-//
-//  Impl          Compile Time    Object Size
-// -------------------------------------------
-// std::_IsSame:    689.634 ms     356 K
-// std::is_same:  8,129.180 ms     560 K
-//
-// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/orig.o -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
-// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17 -DTEST_NEW
-
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-#include "template_cost_testing.h"
-
-template <int N> struct Arg { enum { value = 1 }; };
-
-#ifdef TEST_NEW
-#define IS_SAME  std::_IsSame
-#else
-#define IS_SAME std::is_same
-#endif
-
-#define TEST_CASE_NOP() IS_SAME < Arg< __COUNTER__ >, Arg < __COUNTER__ > >::value,
-#define TEST_CASE_TYPE() IS_SAME < Arg< __COUNTER__ >, Arg < __COUNTER__ > >,
-
-int sink(...);
-
-int x = sink(
-  REPEAT_10000(TEST_CASE_NOP)
-  REPEAT_10000(TEST_CASE_NOP) 42
-);
-
-void Foo( REPEAT_1000(TEST_CASE_TYPE) int) { }
-
-static_assert(__COUNTER__ > 10000, "");
-
-void escape() {
-
-sink(&x);
-sink(&Foo);
-}
diff --git a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp b/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp
deleted file mode 100644
index 4815ce37b0883..0000000000000
--- a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_metafunctions.sh.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a dummy feature that prevents this test from running by default.
-// REQUIRES: template-cost-testing
-
-// The table below compares the compile time and object size for each of the
-// variants listed in the RUN script.
-//
-//  Impl          Compile Time    Object Size
-// -------------------------------------------
-// _And:         3,498.639 ms     158 M
-// __lazy_and:  10,138.982 ms     334 M
-// __and_:      14,181.851 ms     648 M
-//
-
-// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/new.o -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -std=c++17
-// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/lazy.o -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace  -std=c++17 -DTEST_LAZY_AND
-// RUN: %{cxx} %{flags} %{compile_flags} -c %s -o %S/std.o -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace   -std=c++17 -DTEST_STD_AND
-
-#include <type_traits>
-#include <cassert>
-
-#include "test_macros.h"
-#include "template_cost_testing.h"
-using std::true_type;
-using std::false_type;
-
-#define FALSE_T() std::false_type,
-#define TRUE_T() std::true_type,
-
-#ifdef TEST_LAZY_AND
-#define TEST_AND std::__lazy_and
-#define TEST_OR std::__lazy_or
-#elif defined(TEST_STD_AND)
-#define TEST_AND std::__and_
-#define TEST_OR std::__or_
-#else
-#define TEST_AND std::_And
-#define TEST_OR std::_Or
-#endif
-
-void sink(...);
-
-void Foo1(TEST_AND < REPEAT_1000(TRUE_T) true_type > t1) { sink(&t1); }
-void Foo2(TEST_AND < REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type > t2) { sink(&t2); }
-void Foo3(TEST_AND < REPEAT_1000(TRUE_T) true_type, false_type > t3) { sink(&t3); }
-void Foo4(TEST_AND < REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type, false_type > t4) { sink(&t4); }
-void Foo5(TEST_AND < false_type, REPEAT_1000(TRUE_T) true_type > t5) { sink(&t5); }
-void Foo6(TEST_AND < false_type, REPEAT_1000(TRUE_T) REPEAT_1000(TRUE_T) true_type > t6) { sink(&t6); }
-
-void escape() {
-
-sink(&Foo1);
-sink(&Foo2);
-sink(&Foo3);
-sink(&Foo4);
-sink(&Foo5);
-sink(&Foo6);
-}
diff --git a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp b/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
deleted file mode 100644
index b0512325d4c2c..0000000000000
--- a/libcxx/test/libcxx/utilities/meta/stress_tests/stress_test_variant_overloads_impl.sh.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This is a dummy feature that prevents this test from running by default.
-// REQUIRES: template-cost-testing
-
-// Test the cost of the mechanism used to create an overload set used by variant
-// to determine which alternative to construct.
-
-// The table below compares the compile time and object size for each of the
-// variants listed in the RUN script.
-//
-//  Impl           Compile Time  Object Size
-// -----------------------------------------------------
-// flat:              959 ms        792 KiB
-// recursive:      23,444 ms     23,000 KiB
-// -----------------------------------------------------
-// variant_old:    16,894 ms     17,000 KiB
-// variant_new:     1,105 ms        828 KiB
-
-
-// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
-// RUN:    -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
-// RUN:    -DTEST_NS=flat_impl -o %S/flat.o
-// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
-// RUN:    -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
-// RUN:    -DTEST_NS=rec_impl -o %S/rec.o
-// RUN: %{cxx} %{flags} %{compile_flags} -std=c++17 -c %s \
-// RUN:    -ggdb  -ggnu-pubnames -ftemplate-depth=5000 -ftime-trace -g \
-// RUN:    -DTEST_NS=variant_impl -o %S/variant.o
-
-#include <type_traits>
-#include <tuple>
-#include <cassert>
-#include <variant>
-
-#include "test_macros.h"
-#include "template_cost_testing.h"
-
-template <std::size_t Idx>
-struct TestType {};
-
-template <class T>
-struct ID {
-  using type = T;
-};
-
-namespace flat_impl {
-
-struct OverloadBase { void operator()() const; };
-
-template <class Tp, std::size_t Idx>
-struct Overload {
-  auto operator()(Tp, Tp) const -> ID<Tp>;
-};
-
-template <class ...Bases>
-struct AllOverloads : OverloadBase, Bases... {};
-
-template <class IdxSeq>
-struct MakeOverloads;
-
-template <std::size_t ..._Idx>
-struct MakeOverloads<std::__tuple_indices<_Idx...> > {
-  template <class ...Types>
-  using Apply = AllOverloads<Overload<Types, _Idx>...>;
-};
-
-template <class ...Types>
-using Overloads = typename MakeOverloads<
-    std::__make_indices_imp<sizeof...(Types), 0> >::template Apply<Types...>;
-
-} // namespace flat_impl
-
-
-namespace rec_impl {
-
-template <class... Types> struct Overload;
-
-template <>
-struct Overload<> { void operator()() const; };
-
-template <class Tp, class... Types>
-struct Overload<Tp, Types...> : Overload<Types...> {
-  using Overload<Types...>::operator();
-  auto operator()(Tp, Tp) const -> ID<Tp>;
-};
-
-template <class... Types>
-using Overloads = Overload<Types...>;
-
-} // namespace rec_impl
-
-namespace variant_impl {
-  template <class ...Types>
-  using Overloads = std::__variant_detail::_MakeOverloads<Types...>;
-  } // namespace variant_impl
-
-#ifndef TEST_NS
-#error TEST_NS must be defined
-#endif
-
-#define TEST_TYPE() TestType< __COUNTER__ >,
-using T1 = TEST_NS::Overloads<REPEAT_1000(TEST_TYPE) TestType<1>, TestType<1>, int>;
-static_assert(__COUNTER__ >= 1000, "");
-
-void fn1(T1 x) { DoNotOptimize(&x); }
-void fn2(typename std::invoke_result_t<T1, int, int>::type x) { DoNotOptimize(&x); }
-
-int main(int, char**) {
-  DoNotOptimize(&fn1);
-  DoNotOptimize(&fn2);
-  return 0;
-}
diff --git a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
deleted file mode 100644
index ae8464ac946a9..0000000000000
--- a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// test that <bitset> includes <string>, <stdexcept> and <iosfwd>
-
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
-#include <bitset>
-
-#include "test_macros.h"
-
-#ifndef _LIBCPP_STRING
-#error <string> has not been included
-#endif
-
-#ifndef _LIBCPP_STDEXCEPT
-#error <stdexcept> has not been included
-#endif
-
-#ifndef _LIBCPP_IOSFWD
-#error <iosfwd> has not been included
-#endif
-
-int main(int, char**)
-{
-
-  return 0;
-}
diff --git a/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp b/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp
new file mode 100644
index 0000000000000..5267f6f521547
--- /dev/null
+++ b/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <math.h>
+
+// [support.c.headers.other]/1
+//   ... except for the functions described in [sf.cmath], the
+//   std::lerp function overloads ([c.math.lerp]) ...
+
+#include <cassert>
+#include <math.h>
+
+template <class = int>
+int lerp(float, float, float) { return 32; }
+
+template <class = int>
+int lerp(double, double, double) { return 32; }
+
+template <class = int>
+int lerp(long double, long double, long double) { return 32; }
+
+int main(int, char**) {
+  assert(lerp(0.f, 0.f, 0.f) == 32);
+  assert(lerp(0., 0., 0.) == 32);
+  assert(lerp(0.l, 0.l, 0.l) == 32);
+
+  return 0;
+}
diff --git a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
rename to libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
diff --git a/libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
rename to libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp
deleted file mode 100644
index 2be9cb4187fa2..0000000000000
--- a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// <thread>
-
-// template <class Rep, class Period>
-//   void sleep_for(const chrono::duration<Rep, Period>& rel_time);
-
-// The std::this_thread::sleep_for test requires POSIX specific headers and
-// is therefore non-standard. For this reason the test lives under the 'libcxx'
-// subdirectory.
-
-int main(int, char**)
-{
-
-  return 0;
-}
diff --git a/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/visibility_inlines_hidden.cpp
similarity index 97%
rename from libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp
rename to libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/visibility_inlines_hidden.cpp
index 3714e4037a2dc..fe5e49f715787 100644
--- a/libcxx/test/libcxx/vendor/ibm/bad_function_call.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/visibility_inlines_hidden.cpp
@@ -6,7 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-// REQUIRES: target={{.+}}-aix{{.*}}
 // ADDITIONAL_COMPILE_FLAGS: -fvisibility-inlines-hidden
 
 // When there is a weak hidden symbol in user code and a strong definition
diff --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/utilities/function.objects/refwrap/binary.pass.cpp
rename to libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp
diff --git a/libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/utilities/function.objects/refwrap/unary.pass.cpp
rename to libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp
diff --git a/libcxx/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/utilities/memory/util.smartptr/race_condition.pass.cpp
rename to libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp b/libcxx/test/std/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
similarity index 100%
rename from libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
rename to libcxx/test/std/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.badcall/visibility_inlines_hidden.cpp libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp libcxx/test/std/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
View the diff from clang-format here.
diff --git a/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp b/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp
index 5267f6f52..f1dd021d2 100644
--- a/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp
+++ b/libcxx/test/std/language.support/support.c.headers/support.c.headers.other/math.lerp.pass.cpp
@@ -16,13 +16,19 @@
 #include <math.h>
 
 template <class = int>
-int lerp(float, float, float) { return 32; }
+int lerp(float, float, float) {
+  return 32;
+}
 
 template <class = int>
-int lerp(double, double, double) { return 32; }
+int lerp(double, double, double) {
+  return 32;
+}
 
 template <class = int>
-int lerp(long double, long double, long double) { return 32; }
+int lerp(long double, long double, long double) {
+  return 32;
+}
 
 int main(int, char**) {
   assert(lerp(0.f, 0.f, 0.f) == 32);
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
index e64a873fa..75479966a 100644
--- a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
+++ b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
@@ -19,8 +19,7 @@
 #include <cassert>
 #include <chrono>
 
-int main(int, char**)
-{
+int main(int, char**) {
   typedef std::chrono::system_clock Clock;
   typedef Clock::time_point time_point;
   std::chrono::milliseconds ms(500);
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
index 1dba5d8a4..c7baa7ab2 100644
--- a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
+++ b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
@@ -33,8 +33,7 @@
 
 void sig_action(int) {}
 
-int main(int, char**)
-{
+int main(int, char**) {
   int ec;
   struct sigaction action;
   action.sa_handler = &sig_action;
@@ -46,7 +45,7 @@ int main(int, char**)
 
   struct itimerval it;
   std::memset(&it, 0, sizeof(itimerval));
-  it.it_value.tv_sec = 0;
+  it.it_value.tv_sec  = 0;
   it.it_value.tv_usec = 250000;
   // This will result in a SIGALRM getting fired resulting in the nanosleep
   // inside sleep_for getting EINTR.
diff --git a/libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp
index f14359f54..194075308 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/binary.pass.cpp
@@ -21,67 +21,52 @@
 
 #include "test_macros.h"
 
-class functor1
-    : public std::unary_function<int, char>
-{
-};
+class functor1 : public std::unary_function<int, char> {};
 
-class functor2
-    : public std::binary_function<char, int, double>
-{
-};
+class functor2 : public std::binary_function<char, int, double> {};
 
-class functor3
-    : public std::unary_function<int, int>,
-      public std::binary_function<char, int, double>
-{
+class functor3 : public std::unary_function<int, int>, public std::binary_function<char, int, double> {
 public:
-    typedef float result_type;
+  typedef float result_type;
 };
 
-class functor4
-    : public std::unary_function<int, int>,
-      public std::binary_function<char, int, double>
-{
+class functor4 : public std::unary_function<int, int>, public std::binary_function<char, int, double> {
 public:
 };
 
-struct C
-{
-    typedef int argument_type;
-    typedef int result_type;
+struct C {
+  typedef int argument_type;
+  typedef int result_type;
 };
 
-int main(int, char**)
-{
-    static_assert((!std::is_base_of<std::binary_function<int, char, int>,
-                                    std::reference_wrapper<functor1> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<char, int, double>,
-                                   std::reference_wrapper<functor2> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<char, int, double>,
-                                   std::reference_wrapper<functor3> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<char, int, double>,
-                                   std::reference_wrapper<functor4> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<int, int, int>,
-                                    std::reference_wrapper<C> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
-                                    std::reference_wrapper<float ()> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
-                                   std::reference_wrapper<float (int)> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<int, int, float>,
-                                    std::reference_wrapper<float (int, int)> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
-                                    std::reference_wrapper<float(*)()> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<int, int, float>,
-                                   std::reference_wrapper<float(*)(int)> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<int, int, float>,
-                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
-    static_assert((!std::is_base_of<std::binary_function<C*, int, float>,
-                                   std::reference_wrapper<float(C::*)()> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<C*, int, float>,
-                                   std::reference_wrapper<float(C::*)(int)> >::value), "");
-    static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
-                                   std::reference_wrapper<float(C::*)(int) const volatile> >::value), "");
+int main(int, char**) {
+  static_assert((!std::is_base_of<std::binary_function<int, char, int>, std::reference_wrapper<functor1> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<char, int, double>, std::reference_wrapper<functor2> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<char, int, double>, std::reference_wrapper<functor3> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<char, int, double>, std::reference_wrapper<functor4> >::value), "");
+  static_assert((!std::is_base_of<std::binary_function<int, int, int>, std::reference_wrapper<C> >::value), "");
+  static_assert((!std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float()> >::value), "");
+  static_assert(
+      (!std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float(int)> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float(int, int)> >::value), "");
+  static_assert(
+      (!std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float (*)()> >::value), "");
+  static_assert(
+      (!std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float (*)(int)> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<int, int, float>, std::reference_wrapper<float (*)(int, int)> >::value),
+      "");
+  static_assert(
+      (!std::is_base_of<std::binary_function<C*, int, float>, std::reference_wrapper<float (C::*)()> >::value), "");
+  static_assert(
+      (std::is_base_of<std::binary_function<C*, int, float>, std::reference_wrapper<float (C::*)(int)> >::value), "");
+  static_assert((std::is_base_of<std::binary_function<const volatile C*, int, float>,
+                                 std::reference_wrapper<float (C::*)(int) const volatile> >::value),
+                "");
 
   return 0;
 }
diff --git a/libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp
index 4d7ab16ec..ef9dcb4ec 100644
--- a/libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp
+++ b/libcxx/test/std/utilities/function.objects/refwrap/unary.pass.cpp
@@ -21,65 +21,43 @@
 
 #include "test_macros.h"
 
-class functor1
-    : public std::unary_function<int, char>
-{
-};
+class functor1 : public std::unary_function<int, char> {};
 
-class functor2
-    : public std::binary_function<char, int, double>
-{
-};
+class functor2 : public std::binary_function<char, int, double> {};
 
-class functor3
-    : public std::unary_function<int, int>,
-      public std::binary_function<char, int, double>
-{
+class functor3 : public std::unary_function<int, int>, public std::binary_function<char, int, double> {
 public:
-    typedef float result_type;
+  typedef float result_type;
 };
 
-class functor4
-    : public std::unary_function<int, int>,
-      public std::binary_function<char, int, double>
-{
+class functor4 : public std::unary_function<int, int>, public std::binary_function<char, int, double> {
 public:
 };
 
-struct C
-{
-    typedef int argument_type;
-    typedef int result_type;
+struct C {
+  typedef int argument_type;
+  typedef int result_type;
 };
 
-int main(int, char**)
-{
-    static_assert((std::is_base_of<std::unary_function<int, char>,
-                                   std::reference_wrapper<functor1> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<char, int>,
-                                    std::reference_wrapper<functor2> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<int, int>,
-                                   std::reference_wrapper<functor3> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<int, int>,
-                                   std::reference_wrapper<functor4> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<int, int>,
-                                    std::reference_wrapper<C> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<int, float>,
-                                    std::reference_wrapper<float(*)()> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<int, float>,
-                                   std::reference_wrapper<float (int)> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<int, float>,
-                                    std::reference_wrapper<float (int, int)> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<int, float>,
-                                   std::reference_wrapper<float(*)(int)> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<int, float>,
-                                    std::reference_wrapper<float(*)(int, int)> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<C*, float>,
-                                   std::reference_wrapper<float(C::*)()> >::value), "");
-    static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
-                                   std::reference_wrapper<float(C::*)() const volatile> >::value), "");
-    static_assert((!std::is_base_of<std::unary_function<C*, float>,
-                                   std::reference_wrapper<float(C::*)(int)> >::value), "");
+int main(int, char**) {
+  static_assert((std::is_base_of<std::unary_function<int, char>, std::reference_wrapper<functor1> >::value), "");
+  static_assert((!std::is_base_of<std::unary_function<char, int>, std::reference_wrapper<functor2> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<int, int>, std::reference_wrapper<functor3> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<int, int>, std::reference_wrapper<functor4> >::value), "");
+  static_assert((!std::is_base_of<std::unary_function<int, int>, std::reference_wrapper<C> >::value), "");
+  static_assert((!std::is_base_of<std::unary_function<int, float>, std::reference_wrapper<float (*)()> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<int, float>, std::reference_wrapper<float(int)> >::value), "");
+  static_assert(
+      (!std::is_base_of<std::unary_function<int, float>, std::reference_wrapper<float(int, int)> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<int, float>, std::reference_wrapper<float (*)(int)> >::value), "");
+  static_assert(
+      (!std::is_base_of<std::unary_function<int, float>, std::reference_wrapper<float (*)(int, int)> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<C*, float>, std::reference_wrapper<float (C::*)()> >::value), "");
+  static_assert((std::is_base_of<std::unary_function<const volatile C*, float>,
+                                 std::reference_wrapper<float (C::*)() const volatile> >::value),
+                "");
+  static_assert(
+      (!std::is_base_of<std::unary_function<C*, float>, std::reference_wrapper<float (C::*)(int)> >::value), "");
 
   return 0;
 }
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp
index cbecd2d1d..896df13c3 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/race_condition.pass.cpp
@@ -30,54 +30,57 @@ std::atomic_bool Start;
 std::atomic_bool KeepRunning;
 
 struct TestRunner {
-    TestRunner(Ptr xx) : x(xx) {}
-    void operator()() {
-        while (Start == false) {}
-        while (KeepRunning) {
-            // loop to prevent always checking the atomic.
-            for (int i=0; i < 100000; ++i) {
-                Ptr x2 = x; // increment shared count
-                WeakPtr x3 = x; // increment weak count
-                Ptr x4 = x3.lock(); // increment shared count via lock
-                WeakPtr x5 = x3; // increment weak count
-            }
-        }
+  TestRunner(Ptr xx) : x(xx) {}
+  void operator()() {
+    while (Start == false) {
     }
-    Ptr x;
+    while (KeepRunning) {
+      // loop to prevent always checking the atomic.
+      for (int i = 0; i < 100000; ++i) {
+        Ptr x2     = x;         // increment shared count
+        WeakPtr x3 = x;         // increment weak count
+        Ptr x4     = x3.lock(); // increment shared count via lock
+        WeakPtr x5 = x3;        // increment weak count
+      }
+    }
+  }
+  Ptr x;
 };
 
 void run_test(Ptr p) {
-    Start = false;
-    KeepRunning = true;
-    assert(p.use_count() == 2);
-    TestRunner r(p);
-    assert(p.use_count() == 3);
-    std::thread t1 = support::make_test_thread(r); // Start the test thread.
-    assert(p.use_count() == 4);
-    Start = true;
-    // Run until we witness 25 use count changes via both
-    // shared and weak pointer methods.
-    WeakPtr w = p;
-    int shared_changes_count = 0;
-    int weak_changes_count = 0;
-    while (shared_changes_count < 25 && weak_changes_count < 25) {
-        // check use_count on the shared_ptr
-       int last = p.use_count();
-       int new_val = p.use_count();
-       assert(last >= 4);
-       assert(new_val >= 4);
-       if (last != new_val) ++shared_changes_count;
-       // Check use_count on the weak_ptr
-       last = w.use_count();
-       new_val = w.use_count();
-       assert(last >= 4);
-       assert(new_val >= 4);
-       if (last != new_val) ++weak_changes_count;
-    }
-    // kill the test thread.
-    KeepRunning = false;
-    t1.join();
-    assert(p.use_count() == 3);
+  Start       = false;
+  KeepRunning = true;
+  assert(p.use_count() == 2);
+  TestRunner r(p);
+  assert(p.use_count() == 3);
+  std::thread t1 = support::make_test_thread(r); // Start the test thread.
+  assert(p.use_count() == 4);
+  Start = true;
+  // Run until we witness 25 use count changes via both
+  // shared and weak pointer methods.
+  WeakPtr w                = p;
+  int shared_changes_count = 0;
+  int weak_changes_count   = 0;
+  while (shared_changes_count < 25 && weak_changes_count < 25) {
+    // check use_count on the shared_ptr
+    int last    = p.use_count();
+    int new_val = p.use_count();
+    assert(last >= 4);
+    assert(new_val >= 4);
+    if (last != new_val)
+      ++shared_changes_count;
+    // Check use_count on the weak_ptr
+    last    = w.use_count();
+    new_val = w.use_count();
+    assert(last >= 4);
+    assert(new_val >= 4);
+    if (last != new_val)
+      ++weak_changes_count;
+  }
+  // kill the test thread.
+  KeepRunning = false;
+  t1.join();
+  assert(p.use_count() == 3);
 }
 
 int main(int, char**) {
@@ -90,7 +93,7 @@ int main(int, char**) {
   {
     // Test with in-place shared_count.
     int val = 42;
-    Ptr p = std::make_shared<int>(val);
+    Ptr p   = std::make_shared<int>(val);
     run_test(p);
     assert(p.use_count() == 1);
   }

@philnik777 philnik777 force-pushed the move_standard_tests branch from 487420c to 7427ff5 Compare August 13, 2025 08:13
@philnik777 philnik777 merged commit 3ca414b into llvm:main Aug 13, 2025
10 of 14 checks passed
@philnik777 philnik777 deleted the move_standard_tests branch August 13, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants